-/**
 * Created by dywu on 2015/9/24.
 */
angular.module('app.auth', [
    'ngStorage',
])
    .config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
        $stateProvider
            .state('login', {
                url: "/login",
                templateUrl: "view/auth/login.html",
                controller: 'LoginController',
            })
    }])

    //管理员登录

    .controller('LoginController', ['$scope', '$state','LoginService',  function ($scope, $state,LoginService) {
        /*if(state = login){
          $state.go("tab.dash");
        }
         var $storage = $localStorage.$default({
            manager_cookie:{},
            shopid_cookies:"",
        });
        $scope.loginmanager = function (manager) {
          LoginService.login(manager, function (data) {
            $storage.manager_cookie = data;
            alert(JSON.stringify($storage.manager_cookie))
            if (data.sign != 0) {
                ShopService.getbyuserid(data.userid).$promise.then(function(shop){
                 $scope.shop = shop;
                  for(var i=0;i<$scope.shop.length;i++){
                    var shopid = $scope.shop[0].shopid;
                  }
                  $storage.shopid_cookies = shopid,
                  alert($storage.shopid_cookies);
                  $state.go("tab.dash");
                },function(data){
                  alert(data.data.reason)
              })
            }
            else{
              alert('超级管理员请绕路！')
            }
         },function(data){
            alert(data.data.reason)
        })}*/
   }])
;
